package com.supermap.ar.unity.player;

import android.content.Context;
import android.graphics.PixelFormat;
import android.view.SurfaceView;
import android.view.View;

import com.unity3d.player.IUnityPlayerLifecycleEvents;
import com.unity3d.player.UnityPlayer;

/**
 * 前景场景UnityPlayer
 */
public class ForeUnityPlayer extends UnityPlayer {
    public ForeUnityPlayer(Context context) {
        super(context);
    }

    public ForeUnityPlayer(Context context, IUnityPlayerLifecycleEvents iUnityPlayerLifecycleEvents) {
        super(context, iUnityPlayerLifecycleEvents);
    }

    private boolean isFirst = true;
    @Override
    public void addView(View child) {
        if (child instanceof SurfaceView){
            SurfaceView view = (SurfaceView) child;
            view.setZOrderOnTop(true);
//            view.setZOrderMediaOverlay(true);
            view.getHolder().setFormat(PixelFormat.TRANSLUCENT);
        }
        super.addView(child);
    }
}
